<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 声明generator函数
        function* test() {
            yield 1;
            yield 2;
            yield 3;
        }
        let result = test();
        console.log(result);
        console.log(result.next());
        console.log(result.next());
    </script>
</head>

<body>

</body>

</html>